//package com.tanchengjin.admin.service.impl;
//
//import com.tanchengjin.admin.exception.ApplicationException;
//import com.tanchengjin.admin.modules.cms.mapper.ArticleMapper;
//import com.tanchengjin.admin.modules.cms.pojo.Article;
//import com.tanchengjin.admin.service.ArticleService;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//
//import java.util.Date;
//import java.util.List;
//
///**
// * create by  article ServiceImpl
// *
// * @author TanChengjin
// * @version v1.0.0
// * @since v1.0.0
// */
//@Service("articleService")
//public class ArticleServiceImpl implements ArticleService {
//
//    @Autowired
//    private ArticleMapper articleMapper;
//
//    public Article findOneById(long id) {
//        Article article = articleMapper.selectByPrimaryKey(id);
//        return article;
//    }
//
//    public int deleteById(long id) {
//        int i = 0;
//        Article article1 = articleMapper.selectByPrimaryKey(id);
//        if (article1 == null) {
//            throw new ApplicationException("不存在的文章");
//        }
//        Article article = new Article();
//        article.setId(id);
//        article.setDeletedAt(new Date());
//        i = articleMapper.updateByPrimaryKeySelective(article);
////        int i = articleMapper.deleteByPrimaryKey(id);
//        return i;
//
//    }
//
//    public int create(Article article) {
//        int i = articleMapper.insertSelective(article);
//        return i;
//    }
//
//    public int updateById(Article article, long id) {
//        article.setId(id);
//        int i = articleMapper.updateByPrimaryKeySelective(article);
//        return i;
//    }
//
//    public List<Article> getAll() {
//        List<Article> articleList = articleMapper.getAll();
//        return articleList;
//    }
//
//    public List<Article> getAllByCondition(Article article) {
//        List<Article> articleList = articleMapper.getAllByCondition(article);
//        return articleList;
//    }
//
//    public int batchDelete(long[] ids) {
//        int i = 0;
//        i = articleMapper.batchDeleteByPrimaryKey(ids);
////        for (long id : ids) {
////            i += articleMapper.deleteByPrimaryKey(id);
////        }
//        return i;
//    }
//
//    public long count() {
//        return articleMapper.count();
//    }
//}